/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/**
 * \file
 * \brief Test file for some functions of ownutils lib.
 * \author Antti Maula <antti.maula@tkk.fi>
 */
#include "ownutils.h"
#include <stdio.h>
#include <limits.h>

int main(void)
{
  while(1) {
    unsigned int x = ownTime_get_ms();
    unsigned int dl_x = UINT_MAX - x;
    float range_used_percent = 100.0 * ((float)x / (float)UINT_MAX);
    float dl_x_days = dl_x / 1000.0 / 60.0 / 60.0 / 24.0;
    printf("ownTime_get_ms() == %u, %.1f%% of value space used, %u milliseconds left until timer wraps around (about %.6f days)\n", 
           x, range_used_percent, dl_x, dl_x_days);
    usleep(1000*1000);
  }

  return 0;
}
